import React from "react"
import "date-fns";
import DateFnsUtils from "@date-io/date-fns";
import { MuiPickersUtilsProvider, KeyboardTimePicker, KeyboardDatePicker, DatePicker, TimePicker } from "@material-ui/pickers";
import Project from "../pages/Project";

function FormDatePicker(props) {
	var [date, setDate] = React.useState(null);
	return (
		<KeyboardDatePicker
			margin={props.margin||"dense"}
			value={props.value||date}
			onChange={(d) => {
				if(props.onChange)props.onChange(d)
				setDate(d);
			}}
			format="yyyy-MM-dd"
			KeyboardButtonProps={{ "aria-label": "change date" }}
			fullWidth
			{...props}
		></KeyboardDatePicker>
	);
}
function FormTimePicker(props) {
	var [time, setTime] = React.useState(null);
	return (
		<KeyboardTimePicker
			margin={props.margin||"dense"}
			value={props.value||time}
			onChange={(t) => {
				if(props.onChange)props.onChange(t)
				setTime(t);
			}}
			fullWidth
			{...props}
		></KeyboardTimePicker>
	);
}


export {FormDatePicker, FormTimePicker,MuiPickersUtilsProvider,DateFnsUtils}